/*
 * User: Joseph Monaco
 * Date: 1/21/2008
 * Time: 4:45 PM
 */

using System;
using System.Text;

namespace cs2335.cvslab.person
{
	/// <summary>
	/// This class represents a person.
	/// </summary>
	public class Person2 : Person
	{
		public Person2(string pname) : base(pname)
		{
		}
		///<summary>
		///  This method should take the input
		///  and return the characters in random order
		///  for example, given the input gtg123b, it
		///  should return "1g2b3tg".
		/// </summary>
		/// <param name="input">
		///   The string to perform the operation on
		/// </param>
		public override string Process(string input)
		{
			//Peron 2  put implementation here
            StringBuilder MyTempStringBuilder = new StringBuilder("XXXXXXX");
            int count = input.Length;
            int loopCount = input.Length;
            int charNumber = 0;
            for (int i = 0; i < loopCount; i++)
            {
                charNumber = RandomNumber(0, count);
                MyTempStringBuilder[i] = input[charNumber];
                input = input.Remove(charNumber, 1);
                count--;
            }
			return MyTempStringBuilder.ToString();
		}
        private int RandomNumber(int min, int max)
        {
            Random random = new Random();
            return random.Next(min, max);
        }
	}
}
